home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Franz PD
/
Franz PD Disk #334 (1994-06)(Rhein-Sieg-Soft).zip
/
Franz PD Disk #334 (1994-06)(Rhein-Sieg-Soft).adf
/
tracker.library
/
Demos
/
FIB.asm
< prev
next >
Wrap
Assembly Source File
|
1994-01-09
|
5KB
|
229 lines
;TestProgramm für "tracker.library"
; Testet TRK_ExamineName, TRK_ExNext und TRK_FreeFIB
NOLIST
INCLUDE "exec/LVO.i"
INCLUDE "exec/memory.i"
INCLUDE "dos/LVO.i"
INCLUDE "dos/dos.i"
INCLUDE "dos/datetime.i"
INCLUDE "dos/dosextens.i"
INCLUDE "tracker.i"
LIST
Print: MACRO
move.l Output,d1
move.l #\1,d2
CALLDOS VFPrintf
ENDM
_TrackerBase: EQUR a5
_DosBase: EQUR a4
Output: EQUR d7
; WB-Message ?
sub.l a1,a1 ;a1=0->eigener Task
CALLEXEC FindTask ;Wo darf man denn nachschauen ?
move.l d0,a0
tst.l pr_CLI(a0) ;von CLI oder WB aus gestartet ?
bne fromCLI
;von WB aus:
lea pr_MsgPort(a0),a0
move.l a0,-(sp)
CALLEXEC WaitPort ;auf Start-Message warten
move.l (sp)+,a0
CALLEXEC GetMsg ;muß nachher beantwortet werden
move.l d0,WBenchMsg
fromCLI:
; Tracker-Library öffnen
OPENLIB TrName,3
tst.l d0
beq ende_all
move.l d0,_TrackerBase
TRK_OPENSTDLIB DOS,36
tst.l d0
beq ende_trk
move.l d0,_DosBase
tst.l WBenchMsg
bne fromWB
;von CLI aus -> Ausgaben ins CLI-Fenster
CALLDOS Output
move.l d0,Output
bra main
;von WB aus gestartet -> eigenes Window nötig
fromWB: move.l #WdName,d1
move.l #MODE_OLDFILE,d2
CALLTRK TRK_Open
move.l d0,Output
;---------------------------------------------------------------------------
;Haupt-Testteil
EXAMINE: MACRO ;Name
move.l #\1,d1
bsr Examine
ENDM
EXNEXT: MACRO ;was
move.l \1,d2
bsr ExNext
ENDM
FREE: MACRO ;was
move.l \1,d1
bsr FreeFIB
ENDM
main: EXAMINE DirName_1
move.l d0,d4
EXNEXT d0
EXAMINE DirName_2
move.l d0,d6
EXNEXT d0
EXAMINE DirName_3
move.l d0,d5
EXNEXT d4
FREE d6
EXAMINE DirName_4
FREE d5
EXAMINE DirName_5
;---------------------------------------------------------------------------
ende_main:
;ggf. End-Botschaft und Verzögerung
tst.l WBenchMsg
beq ende_trk
move.l Output,d1
move.l #GoodBye,d2
moveq #GoodByeLen,d3
CALLDOS Write
move.l #150,d1
CALL Delay
;Library schließen
ende_trk:
CLOSELIB _TrackerBase
ende_all:
tst.l WBenchMsg ;war da was ?
beq toCLI ;na dann halt nicht
;Message zur WB zurück
move.l WBenchMsg,a1
CALLEXEC ReplyMsg
toCLI: moveq #0,d0
rts
;---------------------------------------------------------------------------
; Unterprogramm: FIB&Lock freigeben (mit Bestätigung)
FreeFIB:
move.l a1,-(sp)
CALLTRK TRK_FreeFIB
move.l sp,d3
Print FreeMsg
addq.l #4,sp
rts
;---------------------------------------------------------------------------
; Unterprogramm: nächste Datei untersuchen lassen
; Parameter: d2 = Adresse des bisher genutzten FIB
; Ergebnis: -
ExNext: move.l d2,-(sp)
move.l sp,d3
Print Next
move.l (sp)+,d2
CALLTRK TRK_ExNext
tst.w d0
bne 1$
Print NoNext
rts
1$: move.l d2,-(sp)
Print YesNext
move.l (sp),a0
bra PrintInfo
;---------------------------------------------------------------------------
; Unterprogramm: Namen untersuchen lassen
; Parameter: d1 = Adresse des Filenamens
; Ergebnis: der FIB
Examine:
move.l d1,-(sp)
move.l sp,d3
Print FileTxt
move.l (sp),d1
CALLTRK TRK_ExamineName
tst.l d0
bne 1$
Print not_existant
add.w #4,sp
rts
1$: move.l d0,(sp)
move.l sp,d3
Print existant
move.l (sp),a0
;Das Datum konvertieren:
PrintInfo:
lea _DateTime,a1
move.l fib_DateStamp(a0),(a1)
move.l fib_DateStamp+4(a0),4(a1)
move.l fib_DateStamp+8(a0),8(a1)
move.l a1,d1
CALLDOS DateToStr
;den ganzen Krimskrams ausgeben:
move.l (sp),a0
pea fib_Comment(a0)
pea Time
pea Date
pea WeekDay
move.l fib_NumBlocks(a0),-(sp)
move.l fib_Size(a0),-(sp)
move.l fib_EntryType(a0),-(sp)
move.l fib_Protection(a0),-(sp)
move.l fib_DirEntryType(a0),-(sp)
move.l fib_DiskKey(a0),-(sp)
pea fib_FileName(a0)
move.l sp,d3
Print Info
add.w #44,sp
move.l (sp)+,d0
rts
;---------------------------------------------------------------------------
WBenchMsg: dc.l 0
_DateTime:
dc.l 0,0,0
dc.b FORMAT_DOS,0
dc.l WeekDay,Date,Time
TrName: TRACKERNAME
WdName: dc.b "CON:0/0/640/200/Examine-Test für tracker.library",0
GoodBye: dc.b 10,"Bye - closing soon !"
GoodByeLen: equ *-GoodBye
DirName_1: dc.b "sys:",0
DirName_2: dc.b "s:Startup-Sequence",0
DirName_3: dc.b "l:",0
DirName_4: dc.b "alpha",0
DirName_5: dc.b "RAM:",0
FreeMsg: dc.b "FIB at $%06lx freed",10,0
FileTxt: dc.b "Datei/Pfad %s",0
not_existant: dc.b " konnte nicht untersucht werden !",10,0
existant: dc.b " wurde untersucht - FIB at $%06lx"
CrLf: dc.b 10,0
Next: dc.b "ExNext($%06lx)",0
NoNext: dc.b " failed",10,0
YesNext: dc.b " succeeded",10,0
Info: dc.b "Name = ",34,"%s",34,10
dc.b "DiskKey = $%06lx",10
dc.b "DirEntryType = %ld",10
dc.b "Protection = $%02lx",10
dc.b "EntryType = %ld",10
dc.b "Size = %ld",10
dc.b "Blocks = %ld",10
dc.b "Date = %s %s %s",10
dc.b "Comment = ",34,"%s",34,10,0
WeekDay: ds.b LEN_DATSTRING
Date: ds.b LEN_DATSTRING
Time: ds.b LEN_DATSTRING
END